<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>LOG-IN</title>
        <script type="text/javascript" language="javascript">
            function validar() {
                var nombre = document.getElementById("nombre").value;
                var pass = document.getElementById("pass").value;
                var msg= "¡¡ERROR!!\n\n";
                var correcto = true;
                if (nombre == ""){
                    msg = msg + " - Falta el usuario.\n";
                    correcto = false
                }
                if (pass == "") {
                    msg = msg + " - Falta la contraseña.";
                    correcto = false;
                }
                if (!correcto) {
                    alert (msg);
                } else {
                    document.formulario.submit();
                }
               
            }
        </script>
        <style type="text/css">
            div#login {
                position:absolute;
                background-color:orange;
                border-color:black;
                border-style:solid;
                border-width:5px;
                width:296px;
                height:81px;
                top:50px;
                left:50%;
                margin-left:-148px
            }
            td.login {
                font-weight: bold;
                font-family: verdana;
            }
            input.login {
                border-color: black;
                border-style: solid;
                border-width: 2px;
            }
            input.login:focus {
                background-color: GhostWhite;
                border-color: blue;
                border-style: solid;
                border-width: 2px;
            }
            input.boton {
                border-width:1px;
                border-style:solid;
                border-color:black;
                background-color:silver;
                color:black;
                width:48%;
            }
            input.boton:hover {
                border-width:1px;
                border-style:solid;
                border-color:black;
                background-color:gray;
                color:white;
                width:48%;
            }
            td.boton {
                text-align:center;
            }
        </style>
    </head>
    <body>
        <div id="login">
            <form method="post" action="validar.jsp" name="formulario">
                <table>
                    <tr>
                        <td class="login">NOMBRE</td>
                        <td><input type="text" id="nombre" name="nombre" class="login"></td>
                    </tr>
                    <tr>
                        <td class="login">PASSWORD</td>
                        <td><input type="password" id="pass" name="pass" class="login"></td>
                    </tr>
                    <tr>
                        <td colspan="2" class="boton">
                            <input type="button" value="Validar" class="boton" onclick="validar()">
                            <input type="reset" value="Borrar" class="boton">
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </body>
</html>